
	
/*
 * 自动计算表单数据
 */
function calFormItem() {
    var domForm = $('#' + window.formObj.c.id_form);
	//年终奖/年 = 发薪标准/月*年终奖标准（月）
	var salaryStandard = parseFloat(domForm.find('input[name="salaryStandard"]').val()); // 发薪标准/月
	var annualBonus = parseFloat(domForm.find('input[name="annualBonus"]').val()); // 年终奖标准（月）
	if((salaryStandard || salaryStandard==0) && (annualBonus || annualBonus==0)){
		var yearEndBonus = (salaryStandard*annualBonus).toFixed(2);
		domForm.find('input[name="yearEndBonus"]').val(yearEndBonus);
	}

	//全年人力成本 = （定薪标准/月+社保（单位）/月+医保（单位）/月+公积金（单位）/月+附加费用）*12+年终奖/年
	var fixsalaryStandard = parseFloat(domForm.find('input[name="fixsalaryStandard"]').val()); // 定薪标准/月
	var socialSecurityByCompany = parseFloat(domForm.find('input[name="socialSecurityByCompany"]').val()); // 社保（单位）/月
	var medicalInsuranceByCompany = parseFloat(domForm.find('input[name="medicalInsuranceByCompany"]').val()); // 医保（单位）/月
	var providentFundByCompany = parseFloat(domForm.find('input[name="providentFundByCompany"]').val()); // 公积金（单位）/月
	var additionalCost = parseFloat(domForm.find('input[name="additionalCost"]').val()); // 附加费用
	var yearEndBonus = parseFloat(domForm.find('input[name="yearEndBonus"]').val()); // 年终奖/年
	if((fixsalaryStandard || fixsalaryStandard==0) && (socialSecurityByCompany || socialSecurityByCompany==0) && (medicalInsuranceByCompany || medicalInsuranceByCompany==0)
		&& (providentFundByCompany || providentFundByCompany==0) && (yearEndBonus || yearEndBonus==0)){
		var humanResourcesCost = ((fixsalaryStandard + socialSecurityByCompany + medicalInsuranceByCompany
			+ providentFundByCompany ) * 12
			+ yearEndBonus).toFixed(2);
		domForm.find('input[name="humanResourcesCost"]').val(humanResourcesCost);
	}
	if((fixsalaryStandard || fixsalaryStandard==0) && (socialSecurityByCompany || socialSecurityByCompany==0) && (medicalInsuranceByCompany || medicalInsuranceByCompany==0)
		&& (providentFundByCompany || providentFundByCompany==0) && (additionalCost || additionalCost==0) && (yearEndBonus || yearEndBonus==0)){
		var humanResourcesCost = ((fixsalaryStandard + socialSecurityByCompany + medicalInsuranceByCompany
			+ providentFundByCompany + additionalCost) * 12
			+ yearEndBonus).toFixed(2);
		domForm.find('input[name="humanResourcesCost"]').val(humanResourcesCost);
	}


	

}



function getDingDingUserIdByPhone() {
	var domForm1 = $('#' + window.formObj.c.id_form);
	var telephone = domForm1.find('input[name="telephone"]').val(); // 联系电话
	var userId = domForm1.find('input[name="userId"]').val(); // 工号
	if(userId==undefined || userId==null || userId==''){
		layer.msg("请先选择用户！");
		return;
	}
	layer.open({
		shadeClose:true,
		title: '填入钉钉中设置的手机号',
		content: `
								<form class="layui-form">
								  <div class="layui-form-item">
									 <input type="text" class="layui-input" id="inputTelephone" value="`+telephone+`" placeholder="填入钉钉中设置的手机号">
								  </div>
								</form>
							`,
		success: function(layero, index) {},
		yes: function (index, layero) {
			var inputTelephone = $('#inputTelephone').val();
			if(inputTelephone==undefined || inputTelephone==null || inputTelephone==''){
				layer.msg("请输入您在钉钉设置的手机号！");
				return;
			}
			$.ajax({
				type: "POST",
				url: '/api/inter/tbUserAttendance/getDingDingUserIdByPhone',
				data: {
					userId:userId,
					telephone:inputTelephone
				},
				success: function (data) {
					if (data.code == 0) {
						var domForm = $('#' + window.formObj.c.id_form);
						domForm.find('input[name="dingDingId"]').val(data.msg);
						$('#dingDingIdInput').val(data.msg);
						layer.msg('成功！');
						setTimeout(function(){
							layer.closeAll();
						}, 1000);
					} else {
						layer.msg(data.msg);
						layer.closeAll();
					}
				}
			});
		}
	});
}